//
// Created by hi on 25-4-23.
//
#include <stdio.h>
#include <string.h>
int main() {
    char name[20] = "zhangsan";
    printf("占用字符大小：%d\n", sizeof(name));
    printf("字符串字符大小：%d\n", strlen(name));
    //获取字符串
    gets(name);
    printf("更新后字符串大小：%d\n", strlen(name));
    char name2[20];
    //拷贝字符串
    strcpy(name2, name);
    printf("拷贝后的字符串%s\n",name2);
    //拼接字符串
    strcat(name2, "456");
    printf("拼接后的字符串%s\n",name2);
    //比较ascii码的大小
    if(strcmp(name,name2)==0) {
        printf('字符串相等');
    }else if(strcmp(name,name2)>0) {
        printf("%s 大于 %s",name,name2);
    }else if(strcmp(name,name2)<0) {
        printf("%s 小于 %s",name,name2);
    }

}